package com.matt.controller;

import com.matt.commons.model.StatusResponse;
import com.matt.commons.utils.HttpClientUtil;
import com.matt.commons.utils.JsonUtil;
import com.matt.commons.utils.ModelUtil;
import com.matt.commons.utils.RemoteCallUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;


/**
 * (ActivePoll)表控制层
 *
 * @author makejava
 * @since 2025-02-21 15:04:17
 */
@RestController
@RequestMapping("/evaluateApi")
public class EvaluateApiController {

    @Value("${evaluate.server.url}")
    private String evaluateServerURL;


    /**
     * 新增请假
     */
    @PostMapping("/list1")
    public StatusResponse saveChildrenLeaveRequest(@RequestBody Map aboutPallet) throws IOException {
        String json = HttpClientUtil.sendPost(evaluateServerURL + "/api/evaluate/eapi/operator/reportsNoTicket",aboutPallet);
//        String call = RemoteCallUtil.call(evaluateServerURL + "/api/evaluate/eapi/operator/reportsNoTicket", aboutPallet, aboutPallet.get("ticket"), String.class, "调用sso获取用户信息出错");
        StatusResponse response = JsonUtil.getResponse(json, "errorMsg");
        return response;
    }


    /**
     * 新增请假
     */
    @PostMapping("/detail1")
    public StatusResponse saveChildrenLeaveRequest1(@RequestBody Map aboutPallet) throws IOException {
        String json = HttpClientUtil.sendPost(evaluateServerURL + "/api/evaluate/eapi/operator/detail1",aboutPallet);
        StatusResponse response = JsonUtil.getResponse(json, "errorMsg");
        return response;
    }

    /**
     * 新增请假
     */
    @PostMapping("/word_export1")
    public StatusResponse saveChildrenLeaveRequest2(@RequestBody Map aboutPallet) throws IOException {
        String json = HttpClientUtil.sendPost(evaluateServerURL + "/api/evaluate/eapi/exports/word_export2",aboutPallet);
        StatusResponse response = JsonUtil.getResponse(json, "errorMsg");
        return response;
    }



}

